package com.itheima.test;

import com.itheima.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Description:
 *
 * @author codermao
 * @date 2023/11/2 21:30
 */
public class UserTest2 {
    @Test
    public void test01(){
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext_quit.xml");
        UserService userService = (UserService)ctx.getBean("userService5");
        userService.save();
    }

    /**
     * 集合数据注入
     */
    @Test
    public void test02(){
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext_quit.xml");
        UserService userService = (UserService)ctx.getBean("userServiceImpl5");
        userService.save();
    }

    /**
     * el表达式
     */
    @Test
    public void test03(){
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext_quit.xml");
        UserService userService = (UserService)ctx.getBean("userService8");
        userService.save();
        System.out.println("-------------------------------");
        UserService userService2 = (UserService)ctx.getBean("userService9");
        userService2.save();
    }
}
